document.write("<script type='text/javascript' src='"+getHost()+"js/basicCommon/plugins/gooPieChart/excanvas.compiled.js'></script>");
document.write("<script type='text/javascript' src='"+getHost()+"js/basicCommon/plugins/gooPieChart/GooFunc.js'></script>");
document.write("<script type='text/javascript' src='"+getHost()+"js/basicCommon/plugins/gooPieChart/GooPieChart.js'></script>");   
document.write("<link type='text/css' rel='stylesheet' href='"+getHost()+"theme/"+getTheme()+"/css/plugins/gooPieChart/GooPieChart.css'/>");


function gooChart(pie_params,css_params,c_type,c_divid){
   var canvas;
   var len = eval(pie_params).length;
   
   
   var property={
       con_width:430,
       con_height:300,
       canvas_width:320,
       canvas_height:320,
       canvas_top:40,
       canvas_left:80,
       core_x:100,
       core_y:100,
       radius:100
   }
   

   
   
   var dataKind={
       note_width:100,
       note_height:140,
       note_top:30,
       note_left:300,
       sort_type:'v',
       text_color:'#ffffff'
   }
   
   
   if(css_params != null){
      property.con_width = css_params.con_width,
      property.con_height = css_params.con_height,
      property.canvas_width = css_params.canvas_width,
      property.canvas_height = css_params.canvas_height,
      property.canvas_top = css_params.canvas_top,
      property.canvas_left = css_params.canvas_left,
      property.core_x = css_params.core_x,
      property.core_y = css_params.core_y,
      property.radius = css_params.radius,
      dataKind.note_width = css_params.note_width,
      dataKind.note_height = css_params.note_height,
      dataKind.note_top = css_params.note_top,
      dataKind.note_left = css_params.note_left,
      dataKind.sort_type = css_params.sort_type,
      dataKind.text_color = css_params.text_color
   }
   
   
   

   
   var c_names = new Array(len);
   var c_values = new Array(len);
   var c_colors = new Array(len);
   
   for(var i = 0; i<len; i++){
      c_names[i] = pie_params[i].label;
      c_colors[i] = pie_params[i].color;
      c_values[i] = pie_params[i].num;
   }
   
   
   
   
   var c_items = "[";
   
   for(var i=0;i<len;i++){
      c_items += "{id:" + "\"" + "c"+ i  +"\",color:" + "\"" + c_colors[i] + "\"" + ",label:" + "\"" + c_names[i] + "\"},"; 
   }
   
   c_items = c_items.substring(0,c_items.lastIndexOf(','));
   c_items  += "]";
   
   var items = eval(c_items);
   
   dataKind.items = items;
   
   var c_data="[";
   
   for(var i=0;i<len;i++){
      c_data +="{id:" + "\"" + "c"+ i +"\",num:" + c_values[i] + "},";  
   }
   
   c_data = c_data.substring(0,c_data.lastIndexOf(','));
   c_data  += "]";
   
   var data = eval(c_data);
   


   
   
   var mycanvas = "#" + c_divid;
   
   $(document).ready(function(){
      canvas=$.createGooPieChart($(mycanvas),property);
      canvas.setDataKind(dataKind);
      canvas.loadPieData(data,c_type,"");
   });
}
